package com.jiamu.redistest;

import org.redisson.api.RedissonClient;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://47.119.126.27:6379")
                .setPassword("yinyu@hz2025"); // Set password if required

        config.setCodec(new JsonJacksonCodec()); // Optional: Use JSON serialization
        return org.redisson.Redisson.create(config);
    }
}